package com.ruoyi.safe.task;

import com.ruoyi.safe.constant.SafeJobConstants;
import com.ruoyi.safe.service.IPlanService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@Component
@Slf4j
@AllArgsConstructor
public class DangerTimeUpdateJob {

    private IPlanService planService;

    @XxlJob(value = SafeJobConstants.DANGER_TIME_UPDATE)
    public ReturnT<String> executeJob() {
        try {
            planService.DangerTimeUpdate();
            log.info("===== 调度执行成功 =====");
        } catch (Exception e) {
            log.error("===== 调度发生的异常为：{}", e.getMessage());
            return ReturnT.FAIL;
        }
        return ReturnT.SUCCESS;
    }
}
